import { Component } from 'react'
import { connect } from 'react-redux'
import { toggleShowList } from '../../redux/actions/stat'
class Stat extends Component{
  toggleShowList = () => {
    this.props.toggleShowList()
  }
  render() {
    return (
      <div>
        <div>当前有{this.props.list.length}个人</div>
        <div>
          <span>是否显示list:</span>
          <input type="checkbox" checked={this.props.ifShowList} onChange={this.toggleShowList} />
        </div>
      </div>
    )
  }
}
export default connect(
  state => ({
    list: state.list,
    ifShowList: state.ifShowList
  }),
  {
    toggleShowList
  }
)(Stat)